if(toolbox_values.dtb_vb_enabled!=='1'||(toolbox_values.dtb_vb_enabled==='1'&&self==top)){
jQuery(document).ready(function ($){
function dtb_equalize_heights(selector){
var heights=new Array();
$(selector).each(function(){
$(this).css('min-height', '0');
$(this).css('max-height', 'none');
$(this).css('height', 'auto');
heights.push($(this).height());
});
var max=Math.max.apply(Math, heights);
$(selector).each(function(){
$(this).css('height', max + 'px');
});
}
function dtb_equalize_heights_min(selector){
var heights=new Array();
$(selector).each(function(){
$(this).css('min-height', '0');
$(this).css('max-height', 'none');
$(this).css('height', 'auto');
heights.push($(this).height());
});
var min=Math.min.apply(Math, heights);
$(selector).each(function(){
$(this).css('height', min + 'px');
});
}
function dtb_equalize(){
var iv=null;
if(iv!==null){window.clearTimeout(iv);}
iv=setTimeout(function(){
if(toolbox_values.dtb_equal_archive_boxed==1){
dtb_equalize_heights('.dtb_archives .et_pb_post .dtb-post-wrap, .dtb-blog.et_pb_module .et_pb_post .dtb-post-wrap');
}
if(toolbox_values.dtb_equal_archive_img==1){
dtb_equalize_heights_min('.entry-featured-image-url');
}}, 120);
}
dtb_equalize();
$(window).resize(dtb_equalize);
$(document).bind('ready ajaxComplete', function (){
$('.more-link').text(toolbox_values.dtb_readmore_text);
$('#respond #reply-title>span').text(toolbox_values.dtb_comments_text);
$('#dtb-before-footer').detach().insertBefore('#main-footer, .et-l--footer');
$('#dtb-after-footer').detach().insertAfter('#main-footer, .et-l--footer');
$('#dtb-before-header').detach().prependTo('#page-container');
$('#dtb-after-blog-content').detach().insertBefore('#comment-wrap');
});
if((toolbox_values.dtb_btt==1)&&(toolbox_values.dtb_btt_link==1)){
$('.et_pb_scroll_top').append('');
$('.et_pb_scroll_top').off('click');
$('.btt_link').attr('href', toolbox_values.dtb_btt_url);
}
if(toolbox_values.dtb_fixed_scroll==1){
$(window).scroll(function(){
if($(window).scrollTop() >=toolbox_values.dtb_fixed_scroll_offset){
$('body').addClass('scrolled-down');
}else{
$('body').removeClass('scrolled-down');
}});
}
$('.dtb_archives .et_pb_post').contents().filter(function (){ return this.nodeType==3&&$.trim(this.nodeValue).length; }).wrap('
');
$('.dtb_archives .et_pb_post').each(function (){
if($('.dtb-post-wrap', this).length < 1){
$('>:not(.entry-featured-image-url)', this).wrapAll('
');
}
if($('.more-link', this).length < 1){
if((toolbox_values.dtb_archive_button!='')&&(toolbox_values.dtb_archive_styles!='')){
link_target=$(this).find('a').attr('href');
$('.dtb-post-wrap', this).append("" + toolbox_values.dtb_readmore_text + "");
}}
});
if(toolbox_values.dtb_sticky_footer==1){
function positionFooter(){
var mFoo=$("body:not(.et-fb) #main-footer, body:not(.et-fb) .et-l--footer");
var bFoo=$("body:not(.et-fb) #dtb-before-footer");
var aFoo=$("body:not(.et-fb) #dtb-after-footer");
if((($(document.body).height() + mFoo.outerHeight() + bFoo.outerHeight() + aFoo.outerHeight()) < $(window).height()&&mFoo.css("position")=="fixed")||($(document.body).height() < $(window).height()&&mFoo.css("position")!="fixed")){
if(aFoo.outerHeight() > 0){
mFoo.css({
position: "fixed",
bottom: aFoo.outerHeight() + "px",
right: "0",
left: "0"
});
}else{
mFoo.css({
position: "fixed",
bottom: "0",
right: "0",
left: "0"
});
}
bFoo.css({
position: "fixed",
bottom: mFoo.outerHeight() + aFoo.outerHeight() + "px",
right: "0",
left: "0"
});
aFoo.css({
position: "fixed",
bottom: "0",
right: "0",
left: "0"
});
}else{
mFoo.css({
position: "",
bottom: "",
right: "",
left: ""
});
bFoo.css({
position: "",
bottom: "",
right: "",
left: ""
});
aFoo.css({
position: "",
bottom: "",
right: "",
left: ""
});
}}
$(document).ready(function (){
positionFooter();
$(window).scroll(positionFooter);
$(window).resize(positionFooter);
});
}
if(toolbox_values.dtb_enable_typing==1){
var count=0;
$('.et_pb_text.dtb-typing .et_pb_text_inner').each(function (){
$(this).wrap("");
$(this).after("
");
count++;
});
}
if(toolbox_values.dtb_mobile_parallax==1){
$dtb_is_mobile=null!==navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/);
if($dtb_is_mobile){
in_viewport=function(elem){
elementTop=elem.offset().top, elementBottom=elementTop + elem.outerHeight(), viewportTop=$(window).scrollTop(), viewportBottom=viewportTop + $(window).height();
return elementBottom > viewportTop&&elementTop < viewportBottom;
};
$(window).scroll(function(){
$(".dtb-mobile-parallax .et_parallax_bg").each(function(){
var $dtb_parent=$(this).parent();
var $dtb_visible=in_viewport($dtb_parent);
if($dtb_visible){
element_top=$dtb_parent.offset().top,
parallaxHeight=$(this).parent(".et_pb_fullscreen").length&&$(window).height() > $dtb_parent.innerHeight() ? $(window).height():$dtb_parent.innerHeight(),
bg_height=.2 * $(window).height() + parallaxHeight,
main_position="translate(0, " + .2 * ($(window).scrollTop() + $(window).height() - element_top) + "px)";
$(this).css({height: bg_height,"-webkit-transform": main_position,"-moz-transform": main_position,"-ms-transform": main_position,transform: main_position});
}});
});
}}
if(toolbox_values.dtb_enable_popup==1){
var popup_listener=false;
$('#popup1, #popup2, #popup3, #popup4, #popup5').each(function(){
var dtb_popup_container=$(this);
if(dtb_popup_container.children('#et-boc').length==0){
dtb_popup_container.children('div').wrap('');
}});
$('.popup1').each(function (){
$(this).addClass('trigger-popup').attr('data-mfp-src', '#popup1');
});
$('.popup2').each(function (){
$(this).addClass('trigger-popup').attr('data-mfp-src', '#popup2');
});
$('.popup3').each(function (){
$(this).addClass('trigger-popup').attr('data-mfp-src', '#popup3');
});
$('.popup4').each(function (){
$(this).addClass('trigger-popup').attr('data-mfp-src', '#popup4');
});
$('.popup5').each(function (){
$(this).addClass('trigger-popup').attr('data-mfp-src', '#popup5');
});
if(toolbox_values.dtb_popup_number==1){
$('a[href="#popup1"]').addClass('trigger-popup');
}
if(toolbox_values.dtb_popup_number==2){
$('a[href="#popup1"],a[href="#popup2"]').addClass('trigger-popup');
}
if(toolbox_values.dtb_popup_number==3){
$('a[href="#popup1"],a[href="#popup2"],a[href="#popup3"]').addClass('trigger-popup');
}
if(toolbox_values.dtb_popup_number==4){
$('a[href="#popup1"],a[href="#popup2"],a[href="#popup3"],a[href="#popup4"]').addClass('trigger-popup');
}
if(toolbox_values.dtb_popup_number==5){
$('a[href="#popup1"],a[href="#popup2"],a[href="#popup3"],a[href="#popup4"],a[href="#popup5"]').addClass('trigger-popup');
}
$('.trigger-popup').addClass('et_smooth_scroll_disabled');
$('.trigger-popup').magnificPopup({
type: 'inline',
mainClass: 'toolbox',
fixedContentPos: true,
zoom: { enabled: true, duration: 2000, easing: 'ease-in-out' },
callbacks: { open: function (){ $('body').addClass('blurred'); }, close: function (){ $('body').removeClass('blurred'); }},
prependTo: '#page-container'
});
$('.toolbox .mfp-content').addClass('container');
$('.mobile_menu_bar').click(function (){
if(!popup_listener){
popup_listener=true;
$('.trigger-popup').magnificPopup({
type: 'inline',
mainClass: 'toolbox',
fixedContentPos: true,
zoom: { enabled: true, duration: 2000, easing: 'ease-in-out' },
callbacks: { open: function (){ $('body').addClass('blurred'); }, close: function (){ $('body').removeClass('blurred'); }},
prependTo: '#page-container'
});
}})
}
if(toolbox_values.dtb_social_links==1){
if(toolbox_values.dtb_skype_url!=''){
$('.et-social-icons').append('Skype')
}
if(toolbox_values.dtb_instagram_url!=''){
$('.et-social-icons').append('Instagram')
}
if(toolbox_values.dtb_youtube_url!=''){
$('.et-social-icons').append('YouTube')
}
if(toolbox_values.dtb_linkedin_url!=''){
$('.et-social-icons').append('LinkedIn')
}
if(toolbox_values.dtb_pinterest_url!=''){
$('.et-social-icons').append('Pinterest')
}
if(toolbox_values.dtb_tumblr_url!=''){
$('.et-social-icons').append('Tumblr')
}
if(toolbox_values.dtb_flickr_url!=''){
$('.et-social-icons').append('Flickr')
}
if(toolbox_values.dtb_dribble_url!=''){
$('.et-social-icons').append('Dribble')
}
if(toolbox_values.dtb_vimeo_url!=''){
$('.et-social-icons').append('Vimeo')
}}
if(toolbox_values.dtb_social_target==1){
$('.et-social-icon a').attr('target', '_blank');
}
if((toolbox_values.dtb_social_move==1)&&(toolbox_values.dtb_social_enable==1)){
$('#top-header .et-social-icons').detach();
}
if(toolbox_values.dtb_social_enable==1){
$('#top-header .et-social-icons a, #main-header .et-social-icons a').addClass(toolbox_values.social_head_hover);
$('#footer-bottom .et-social-icons a').addClass(toolbox_values.social_foot_hover);
}
$('#footer-bottom .et-social-icons a').width($('#footer-bottom .et-social-icons a').height());
$(window).on('resize', function (){
$('#footer-bottom .et-social-icons a').width($('#footer-bottom .et-social-icons a').height());
});
if((toolbox_values.dtb_fixed_logo==1)&&(toolbox_values.dtb_fixed_logo_url!='')){
var oldURL=$('#logo').attr('src');
if($('#main-header').hasClass('et-fixed-header')){
$('#logo').attr('src', toolbox_values.dtb_fixed_logo_url);
}
$(window).on('scroll', function (){
if($('#main-header').hasClass('et-fixed-header')){
$('#logo').attr('src', toolbox_values.dtb_fixed_logo_url);
}else{
$('#logo').attr('src', oldURL);
}});
}
if((toolbox_values.dtb_mobile_logo==1)&&(toolbox_values.dtb_mobile_logo_url!='')){
var desktopURL=$('#logo').attr('src');
function checkWidth(){
var windowsize=$(window).width();
if(windowsize < toolbox_values.dtb_mobile_breakpoint){
$('#logo').attr('src', toolbox_values.dtb_mobile_logo_url);
}else{
$('#logo').attr('src', desktopURL);
}
$(window).on('scroll', function (){
var windowsize=$(window).width();
if(windowsize < toolbox_values.dtb_mobile_breakpoint){
$('#logo').attr('src', toolbox_values.dtb_mobile_logo_url);
}});
}
checkWidth();
$(window).resize(checkWidth);
}
if(toolbox_values.dtb_comments_styles=='1'){
$('#respond #submit, .comment-reply-link').addClass(toolbox_values.dtb_comments_btn_hover);
}
$('.et_pb_button').addClass(toolbox_values.dtb_buttons_hover);
$('.' + toolbox_values.dtb_sec_btn_class).removeClass(toolbox_values.dtb_buttons_hover).addClass(toolbox_values.dtb_sec_btn_hover);
function dtb_header_menu_split(){
var $logo_container=$('#main-header > .container > .logo_container'),
$et_top_navigation=$('#et-top-navigation'),
$logo_container_splitted=$('.centered-inline-logo-wrap > .logo_container'),
et_top_navigation_li_size=$et_top_navigation.children('nav').children('ul').children('li').size(),
et_top_navigation_li_break_index=Math.round(et_top_navigation_li_size / 2) - 1,
window_width=window.innerWidth;
if(window_width > toolbox_values.dtb_mobile_breakpoint&&$logo_container.length&&$('body').hasClass('et_header_style_split')){
$('').insertAfter($et_top_navigation.find('nav > ul >li:nth(' + et_top_navigation_li_break_index + ')'));
$logo_container.appendTo($et_top_navigation.find('.centered-inline-logo-wrap'));
}
if(window_width <=toolbox_values.dtb_mobile_breakpoint&&$logo_container_splitted.length){
$logo_container_splitted.prependTo('#main-header > .container');
$('#main-header .centered-inline-logo-wrap').remove();
}}
dtb_header_menu_split();
$(window).resize(function (){
dtb_header_menu_split();
});
var $slide_menu_container=$('.et_header_style_slide .et_slide_in_menu_container');
if($slide_menu_container.length&&!$('body').hasClass('et_pb_slide_menu_active')){
$slide_menu_container.css({ right: '-' + parseInt($slide_menu_container.innerWidth()) + 'px', 'display': 'none' });
}
if(toolbox_values.dtb_post_author!=''){
$('.dtb-author-box').detach().insertAfter('.et_pb_post>.entry-content, .et_pb_module.et_pb_post_content');
}
if(toolbox_values.dtb_post_prev_next!=''){
$('.dtb-single-post-nav').detach().insertAfter('.et_pb_post>.entry-content, .et_pb_module.et_pb_post_content');;
}
if(toolbox_values.dtb_post_related!=''){
$('.dtb-related-posts').detach().insertAfter('.et_pb_post>.entry-content, .et_pb_module.et_pb_post_content');
}
if(toolbox_values.dtb_single_after_content_layout!=''){
$('.dtb-after-single-post').detach().insertAfter('.et_pb_post>.entry-content, .et_pb_module.et_pb_post_content');
}
if(toolbox_values.dtb_hide_post_title!=''){
$('.single-post .et_post_meta_wrapper h1.entry-title').detach();
}
if(toolbox_values.dtb_footer_reveal!=''){
function dtb_footer_height(){
if($("#main-footer").length){
var footer_height=$('#main-footer').height();
}else{
var footer_height=$('.et-l--footer').height();
}
$('#page-container').css('margin-bottom', footer_height);
}
function dtb_remove_footer_height(){
$('#page-container').css('margin-bottom', '0');
}
function dtb_footer_reveal_mobile_conditional(){
if($(window).width() > 980){
dtb_footer_height();
}else{
dtb_remove_footer_height();
}}
if(toolbox_values.dtb_footer_reveal_mobile_off!=''){
dtb_footer_reveal_mobile_conditional()
$(window).resize(function (){
dtb_footer_reveal_mobile_conditional()
});
}else{
dtb_footer_height();
$(window).resize(function (){
dtb_footer_height();
});
}}
if(toolbox_values.dtb_testimonial_photo!=''){
$('.et_pb_testimonial').each(function (){
$('.et_pb_testimonial_portrait', this).detach().insertBefore($(this).find('.et_pb_testimonial_author'));
$('.et_pb_testimonial_portrait, .et_pb_testimonial_author, .et_pb_testimonial_meta', this).wrapAll('');
});
}});
jQuery(window).on("load", function($){
var mbwidth=parseInt(toolbox_values.dtb_mobile_breakpoint);
if((jQuery(window).width() <=mbwidth)&&jQuery('body').hasClass('dtb_mobile_slide')){
jQuery('.mobile_menu_bar').click(function (){
jQuery('body').toggleClass('noscroll');
jQuery('#mobile_menu, .dtb-fixed-always .et_mobile_menu').css('min-height', (jQuery(window).height()) + 'px');
jQuery('#mobile_menu, .dtb-fixed-always .et_mobile_menu').css('max-height', '100vh');
});
}});
if(toolbox_values.dtb_follow_the_mouse==1){
!function (t){ t.fn.directionalHover=function (e){ var n=t.extend({}, t.fn.directionalHover.defaults, e), o=function (t, e, n, o, f, a, r, s){ var u=0; o - s <=a / 2&&(u ^=1), n - r >=f / 2&&(u ^=2), o - s > a / 2&&(u ^=4), n - r < f / 2&&(u ^=8), i(u, t, e, n - r, o - s, f / 2, a / 2) }, i=function (t, e, n, o, i, u, l){ f(t, 9) ? a(o, i, u, l) ? s(e, n, 0, 2 * -u):s(e, n, 2 * -l, 0):f(t, 3) ? r(o, i, u, l) ? s(e, n, 2 * -l, 0):s(e, n, 0, 2 * u):f(t, 12) ? r(o, i, u, l) ? s(e, n, 0, 2 * -u):s(e, n, 2 * l, 0):f(t, 6)&&(a(o, i, u, l) ? s(e, n, 2 * l, 0):s(e, n, 0, 2 * u)) }, f=function (t, e){ return (t & e)===e }, a=function (t, e, n, o){ return o * t - n * e < 0 }, r=function (t, e, n, o){ return n * (e - o) + o * t - n * o < 0 }, s=function (t, e, o, i){ "in"===e ? t.animate({ top: o, left: i }, 0, function (){ t.stop().animate({ top: 0, left: 0 }, n.speed, n.easing) }):"out"===e&&t.animate({ top: 0, left: 0 }, 0, function (){ t.stop().animate({ top: o, left: i }, n.speed, n.easing) }) }; return this.css({ position: "relative", overflow: "hidden" }), this.find(n.overlay).css({ position: "absolute", top: "-100%" }), this.each(function (){ var e=t(this); e.hover(function (t){ o(e.find(n.overlay), "in", t.pageX, t.pageY, e.width(), e.height(), Math.floor(e.offset().left), e.offset().top) }, function (t){ o(e.find(n.overlay), "out", t.pageX, t.pageY, e.width(), e.height(), Math.floor(e.offset().left), e.offset().top) }) }) }, t.fn.directionalHover.defaults={ overlay: ".et_overlay", easing: "swing", speed: 400 }}(jQuery);
(function ($){
var triggerClassChange=$.fn.addClass;
$.fn.addClass=function (){
$(this).trigger('classChanged');
return triggerClassChange.apply(this, arguments);
}})(jQuery);
jQuery(document).ready(function ($){
$('.et_pb_portfolio .et_pb_portfolio_item, .et_pb_fullwidth_portfolio .et_pb_portfolio_item, .et_pb_gallery .et_pb_gallery_item').directionalHover();
$('div.et_pb_portfolio').find('li.et_pb_portfolio_filter a').on('classChanged', function (){
setTimeout(function (){
$('.et_pb_portfolio .et_pb_portfolio_item').directionalHover();
});
});
$('div.et_pb_portfolio').on('classChanged', 'li.page a', function (){
setTimeout(function (){
$('.et_pb_portfolio .et_pb_portfolio_item').directionalHover();
});
});
});
}
if(toolbox_values.dtb_mobile_nested==1){
(function ($){
function dtb_setup_submenus(){
$("").insertBefore(".et_mobile_menu .menu-item-has-children > a");
$(".et_mobile_menu .sub-menu-toggle").click(function (e){
e.preventDefault();
$(this).toggleClass("popped");
});
}
$(document).ready(function (){
dtb_setup_submenus();
});
$(window).on("load", function(){
dtb_setup_submenus();
var parent_links=$(".et_mobile_menu .menu-item-has-children > a");
var toggles=$(".et_mobile_menu .sub-menu-toggle");
parent_links.off();
parent_links.each(function (i){
if($(this).attr("href")=='#'){
$(this).click(function (){
toggles[i].click(function (){
$(this).toggleClass('popped');
});
});
}});
});
})(jQuery);
}}
jQuery(document).ready(function ($){
$(document).bind('ready componentDidMount ajaxComplete', function (){
if((toolbox_values.dtb_blog_layout!='blog_default')&&(toolbox_values.dtb_blog_layout!='')){
$('.dtb-blog.et_pb_module .et_pb_post').each(function (){
if($('.dtb-post-wrap', this).length < 1){
$('>:not(.entry-featured-image-url)', this).wrapAll('');
}});
}
if(toolbox_values.dtb_post_meta==1){
$(".dtb-blog.et_pb_module .post-meta, .archive #left-area .et_pb_post .post-meta, .blog #left-area .et_pb_post .post-meta").html(function (){
return $(this).html().replace(/\|/g, '').replace('by', '').replace('por', '').replace('...', '').replace(/,/g, '');
});
}
if(toolbox_values.dtb_sidebar_search!=''){
$('.et_pb_widget_area #searchsubmit, #sidebar #searchsubmit, .dtb-sidebar #searchsubmit').before('');
}
$('#top-menu-nav #top-menu li a, .dtb-menu ul.et-menu li a').each(function (){
if($('>span', this).length < 1){
$(this).wrapInner('');
}});
if($('.custom_hamburger_icon').length > 0){
var iconName='hamburger_menu_icon',
toggledName=iconName + '-toggled';
$(".mobile_menu_bar").addClass(iconName).html('');
$('.' + iconName).on('click', function (e){
e.preventDefault();
$('.' + iconName).toggleClass(toggledName);
});
}
if(toolbox_values.dtb_cta_link==1){
if(toolbox_values.dtb_cta_link_type=='first_item'){
$('#top-menu>li:first-child, #mobile_menu>li:first-child, .dtb-menu .et-menu>li:first-child, .dtb-menu .et_mobile_menu>li:first-child').addClass('cta-item');
}
if(toolbox_values.dtb_cta_link_type=='last_item'){
$('#top-menu>li:last-child, #mobile_menu>li:last-child, .dtb-menu .et-menu>li:last-child, .dtb-menu .et_mobile_menu>li:last-child').addClass('cta-item');
}
if(toolbox_values.dtb_cta_link_type=='custom_class'){
$('#top-menu>li.cta-link, #mobile_menu>li.cta-link, .dtb-menu .et-menu>li.cta-link, .dtb-menu .et_mobile_menu>li.cta-link').addClass('cta-item');
}
$('#top-menu>li.cta-item>a,.dtb-menu .et-menu>li.cta-item>a').addClass(toolbox_values.cta_hover_style);
}});
});
(function($){
'use strict';
if(typeof wpcf7==='undefined'||wpcf7===null){
return;
}
wpcf7=$.extend({
cached: 0,
inputs: []
}, wpcf7);
$(function(){
wpcf7.supportHtml5=(function(){
var features={};
var input=document.createElement('input');
features.placeholder='placeholder' in input;
var inputTypes=[ 'email', 'url', 'tel', 'number', 'range', 'date' ];
$.each(inputTypes, function(index, value){
input.setAttribute('type', value);
features[ value ]=input.type!=='text';
});
return features;
})();
$('div.wpcf7 > form').each(function(){
var $form=$(this);
wpcf7.initForm($form);
if(wpcf7.cached){
wpcf7.refill($form);
}});
});
wpcf7.getId=function(form){
return parseInt($('input[name="_wpcf7"]', form).val(), 10);
};
wpcf7.initForm=function(form){
var $form=$(form);
$form.submit(function(event){
if(! wpcf7.supportHtml5.placeholder){
$('[placeholder].placeheld', $form).each(function(i, n){
$(n).val('').removeClass('placeheld');
});
}
if(typeof window.FormData==='function'){
wpcf7.submit($form);
event.preventDefault();
}});
$('.wpcf7-submit', $form).after('');
wpcf7.toggleSubmit($form);
$form.on('click', '.wpcf7-acceptance', function(){
wpcf7.toggleSubmit($form);
});
$('.wpcf7-exclusive-checkbox', $form).on('click', 'input:checkbox', function(){
var name=$(this).attr('name');
$form.find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false);
});
$('.wpcf7-list-item.has-free-text', $form).each(function(){
var $freetext=$(':input.wpcf7-free-text', this);
var $wrap=$(this).closest('.wpcf7-form-control');
if($(':checkbox, :radio', this).is(':checked')){
$freetext.prop('disabled', false);
}else{
$freetext.prop('disabled', true);
}
$wrap.on('change', ':checkbox, :radio', function(){
var $cb=$('.has-free-text', $wrap).find(':checkbox, :radio');
if($cb.is(':checked')){
$freetext.prop('disabled', false).focus();
}else{
$freetext.prop('disabled', true);
}});
});
if(! wpcf7.supportHtml5.placeholder){
$('[placeholder]', $form).each(function(){
$(this).val($(this).attr('placeholder'));
$(this).addClass('placeheld');
$(this).focus(function(){
if($(this).hasClass('placeheld')){
$(this).val('').removeClass('placeheld');
}});
$(this).blur(function(){
if(''===$(this).val()){
$(this).val($(this).attr('placeholder'));
$(this).addClass('placeheld');
}});
});
}
if(wpcf7.jqueryUi&&! wpcf7.supportHtml5.date){
$form.find('input.wpcf7-date[type="date"]').each(function(){
$(this).datepicker({
dateFormat: 'yy-mm-dd',
minDate: new Date($(this).attr('min')),
maxDate: new Date($(this).attr('max'))
});
});
}
if(wpcf7.jqueryUi&&! wpcf7.supportHtml5.number){
$form.find('input.wpcf7-number[type="number"]').each(function(){
$(this).spinner({
min: $(this).attr('min'),
max: $(this).attr('max'),
step: $(this).attr('step')
});
});
}
$('.wpcf7-character-count', $form).each(function(){
var $count=$(this);
var name=$count.attr('data-target-name');
var down=$count.hasClass('down');
var starting=parseInt($count.attr('data-starting-value'), 10);
var maximum=parseInt($count.attr('data-maximum-value'), 10);
var minimum=parseInt($count.attr('data-minimum-value'), 10);
var updateCount=function(target){
var $target=$(target);
var length=$target.val().length;
var count=down ? starting - length:length;
$count.attr('data-current-value', count);
$count.text(count);
if(maximum&&maximum < length){
$count.addClass('too-long');
}else{
$count.removeClass('too-long');
}
if(minimum&&length < minimum){
$count.addClass('too-short');
}else{
$count.removeClass('too-short');
}};
$(':input[name="' + name + '"]', $form).each(function(){
updateCount(this);
$(this).keyup(function(){
updateCount(this);
});
});
});
$form.on('change', '.wpcf7-validates-as-url', function(){
var val=$.trim($(this).val());
if(val
&& ! val.match(/^[a-z][a-z0-9.+-]*:/i)
&& -1!==val.indexOf('.')){
val=val.replace(/^\/+/, '');
val='http://' + val;
}
$(this).val(val);
});
};
wpcf7.submit=function(form){
if(typeof window.FormData!=='function'){
return;
}
var $form=$(form);
$('.ajax-loader', $form).addClass('is-active');
wpcf7.clearResponse($form);
var formData=new FormData($form.get(0));
var detail={
id: $form.closest('div.wpcf7').attr('id'),
status: 'init',
inputs: [],
formData: formData
};
$.each($form.serializeArray(), function(i, field){
if('_wpcf7'==field.name){
detail.contactFormId=field.value;
}else if('_wpcf7_version'==field.name){
detail.pluginVersion=field.value;
}else if('_wpcf7_locale'==field.name){
detail.contactFormLocale=field.value;
}else if('_wpcf7_unit_tag'==field.name){
detail.unitTag=field.value;
}else if('_wpcf7_container_post'==field.name){
detail.containerPostId=field.value;
}else if(field.name.match(/^_wpcf7_\w+_free_text_/)){
var owner=field.name.replace(/^_wpcf7_\w+_free_text_/, '');
detail.inputs.push({
name: owner + '-free-text',
value: field.value
});
}else if(field.name.match(/^_/)){
}else{
detail.inputs.push(field);
}});
wpcf7.triggerEvent($form.closest('div.wpcf7'), 'beforesubmit', detail);
var ajaxSuccess=function(data, status, xhr, $form){
detail.id=$(data.into).attr('id');
detail.status=data.status;
detail.apiResponse=data;
var $message=$('.wpcf7-response-output', $form);
switch(data.status){
case 'validation_failed':
$.each(data.invalidFields, function(i, n){
$(n.into, $form).each(function(){
wpcf7.notValidTip(this, n.message);
$('.wpcf7-form-control', this).addClass('wpcf7-not-valid');
$('[aria-invalid]', this).attr('aria-invalid', 'true');
});
});
$message.addClass('wpcf7-validation-errors');
$form.addClass('invalid');
wpcf7.triggerEvent(data.into, 'invalid', detail);
break;
case 'acceptance_missing':
$message.addClass('wpcf7-acceptance-missing');
$form.addClass('unaccepted');
wpcf7.triggerEvent(data.into, 'unaccepted', detail);
break;
case 'spam':
$message.addClass('wpcf7-spam-blocked');
$form.addClass('spam');
wpcf7.triggerEvent(data.into, 'spam', detail);
break;
case 'aborted':
$message.addClass('wpcf7-aborted');
$form.addClass('aborted');
wpcf7.triggerEvent(data.into, 'aborted', detail);
break;
case 'mail_sent':
$message.addClass('wpcf7-mail-sent-ok');
$form.addClass('sent');
wpcf7.triggerEvent(data.into, 'mailsent', detail);
break;
case 'mail_failed':
$message.addClass('wpcf7-mail-sent-ng');
$form.addClass('failed');
wpcf7.triggerEvent(data.into, 'mailfailed', detail);
break;
default:
var customStatusClass='custom-'
+ data.status.replace(/[^0-9a-z]+/i, '-');
$message.addClass('wpcf7-' + customStatusClass);
$form.addClass(customStatusClass);
}
wpcf7.refill($form, data);
wpcf7.triggerEvent(data.into, 'submit', detail);
if('mail_sent'==data.status){
$form.each(function(){
this.reset();
});
wpcf7.toggleSubmit($form);
}
if(! wpcf7.supportHtml5.placeholder){
$form.find('[placeholder].placeheld').each(function(i, n){
$(n).val($(n).attr('placeholder'));
});
}
$message.html('').append(data.message).slideDown('fast');
$message.attr('role', 'alert');
$('.screen-reader-response', $form.closest('.wpcf7')).each(function(){
var $response=$(this);
$response.html('').attr('role', '').append(data.message);
if(data.invalidFields){
var $invalids=$('');
$.each(data.invalidFields, function(i, n){
if(n.idref){
var $li=$('').append($('').attr('href', '#' + n.idref).append(n.message));
}else{
var $li=$('').append(n.message);
}
$invalids.append($li);
});
$response.append($invalids);
}
$response.attr('role', 'alert').focus();
});
};
$.ajax({
type: 'POST',
url: wpcf7.apiSettings.getRoute('/contact-forms/' + wpcf7.getId($form) + '/feedback'),
data: formData,
dataType: 'json',
processData: false,
contentType: false
}).done(function(data, status, xhr){
ajaxSuccess(data, status, xhr, $form);
$('.ajax-loader', $form).removeClass('is-active');
}).fail(function(xhr, status, error){
var $e=$('').text(error.message);
$form.after($e);
});
};
wpcf7.triggerEvent=function(target, name, detail){
var $target=$(target);
var event=new CustomEvent('wpcf7' + name, {
bubbles: true,
detail: detail
});
$target.get(0).dispatchEvent(event);
$target.trigger('wpcf7:' + name, detail);
$target.trigger(name + '.wpcf7', detail);
};
wpcf7.toggleSubmit=function(form, state){
var $form=$(form);
var $submit=$('input:submit', $form);
if(typeof state!=='undefined'){
$submit.prop('disabled', ! state);
return;
}
if($form.hasClass('wpcf7-acceptance-as-validation')){
return;
}
$submit.prop('disabled', false);
$('.wpcf7-acceptance', $form).each(function(){
var $span=$(this);
var $input=$('input:checkbox', $span);
if(! $span.hasClass('optional')){
if($span.hasClass('invert')&&$input.is(':checked')
|| ! $span.hasClass('invert')&&! $input.is(':checked')){
$submit.prop('disabled', true);
return false;
}}
});
};
wpcf7.notValidTip=function(target, message){
var $target=$(target);
$('.wpcf7-not-valid-tip', $target).remove();
$('')
.text(message).appendTo($target);
if($target.is('.use-floating-validation-tip *')){
var fadeOut=function(target){
$(target).not(':hidden').animate({
opacity: 0
}, 'fast', function(){
$(this).css({ 'z-index': -100 });
});
};
$target.on('mouseover', '.wpcf7-not-valid-tip', function(){
fadeOut(this);
});
$target.on('focus', ':input', function(){
fadeOut($('.wpcf7-not-valid-tip', $target));
});
}};
wpcf7.refill=function(form, data){
var $form=$(form);
var refillCaptcha=function($form, items){
$.each(items, function(i, n){
$form.find(':input[name="' + i + '"]').val('');
$form.find('img.wpcf7-captcha-' + i).attr('src', n);
var match=/([0-9]+)\.(png|gif|jpeg)$/.exec(n);
$form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[ 1 ]);
});
};
var refillQuiz=function($form, items){
$.each(items, function(i, n){
$form.find(':input[name="' + i + '"]').val('');
$form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[ 0 ]);
$form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[ 1 ]);
});
};
if(typeof data==='undefined'){
$.ajax({
type: 'GET',
url: wpcf7.apiSettings.getRoute('/contact-forms/' + wpcf7.getId($form) + '/refill'),
beforeSend: function(xhr){
var nonce=$form.find(':input[name="_wpnonce"]').val();
if(nonce){
xhr.setRequestHeader('X-WP-Nonce', nonce);
}},
dataType: 'json'
}).done(function(data, status, xhr){
if(data.captcha){
refillCaptcha($form, data.captcha);
}
if(data.quiz){
refillQuiz($form, data.quiz);
}});
}else{
if(data.captcha){
refillCaptcha($form, data.captcha);
}
if(data.quiz){
refillQuiz($form, data.quiz);
}}
};
wpcf7.clearResponse=function(form){
var $form=$(form);
$form.removeClass('invalid spam sent failed');
$form.siblings('.screen-reader-response').html('').attr('role', '');
$('.wpcf7-not-valid-tip', $form).remove();
$('[aria-invalid]', $form).attr('aria-invalid', 'false');
$('.wpcf7-form-control', $form).removeClass('wpcf7-not-valid');
$('.wpcf7-response-output', $form)
.hide().empty().removeAttr('role')
.removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked');
};
wpcf7.apiSettings.getRoute=function(path){
var url=wpcf7.apiSettings.root;
url=url.replace(wpcf7.apiSettings.namespace,
wpcf7.apiSettings.namespace + path);
return url;
};})(jQuery);
(function (){
if(typeof window.CustomEvent==="function") return false;
function CustomEvent(event, params){
params=params||{ bubbles: false, cancelable: false, detail: undefined };
var evt=document.createEvent('CustomEvent');
evt.initCustomEvent(event,
params.bubbles, params.cancelable, params.detail);
return evt;
}
CustomEvent.prototype=window.Event.prototype;
window.CustomEvent=CustomEvent;
})();